package com.third.customer.site.controller.req;

import com.third.customer.model.dao.param.CustomerHistoryParam;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * Created by hehuaichun on 2020/5/22.
 */
@Data
public class CustomerHistoryReq {

    @NotNull
    private Long customerId;

    private Long sinceTime;

    private Long toTime;

    private int page = 0;

    private int limit = 10;

    public CustomerHistoryParam toParam(){
        CustomerHistoryParam param = new CustomerHistoryParam();
        param.setCustomerId(customerId);
        param.setSinceTime(sinceTime == null ? null : new Date(sinceTime));
        param.setSinceTime(toTime == null ? null : new Date(toTime));
        param.setPage(page);
        param.setLimit(limit);
        return param;
    }
}
